import _dvaDynamic from 'dva/dynamic';

export default [
  {
    path: '/user',
    component: '../layouts/UserLayout',
    routes: [
      { path: '/user', redirect: '/user/login' },
      { path: '/user/login', name: 'login', component: './User/Login' },
      { path: '/user/register', name: 'register', component: './User/Register' },
      {
        path: '/user/register-result',
        name: 'register.result',
        component: './User/RegisterResult',
      },
      {
        component: '404',
      },
    ],
  },
  {
    path: '/',
    component: '../layouts/BasicLayout',
    Routes: ['src/pages/Authorized'],
    // redirect: '/welcome',
    routes: [
      { path: '/', redirect: '/demo/orderlist', authority: ['admin', 'user'] },
      {
        path: '/system',
        name: 'system',
        authority: ['admin'],
        routes: [
          {
            path: '/system/account',
            component: './system/Account',
            name: 'account',
          },
          {
            path: "/system/role",
            name: "role",
            component: './system/Role',
          },
          {
            path: '/system/resources',
            name: 'resources',
            component: './system/Resources',
          },
        ],
      },
      {
        path: '/demo',
        name: 'demo',
        // component: './Demo/OrderList',
        // authority: ['admin', 'user']
        routes: [
          {
            path: '/demo/orderlist',
            name: 'orderlist',
            component: './Demo/OrderList',
            // authority: ['admin', 'user']
          },
          {
            path: '/demo/goodslist',
            name: 'goodslist',
            component: './Demo/Goodslist',
            authority: [ 'user']
          },
          {
            path: '/demo/orderLook',
            component: './Demo/OrderLook',
            // authority: ['admin', 'user']
          },
          {
            path: '/demo/success',
            component: './Demo/Success',
            // authority: ['admin', 'user']
          },
        ],
      },
      {
        name: 'exception',
        icon: 'warning',
        path: '/exception',
        hideInMenu: true,
        routes: [
          // exception
          {
            path: '/exception/403',
            name: 'not-permission',
            hideInMenu: true,
            component: './Exception/403',
          },
          {
            path: '/exception/404',
            name: 'not-find',
            hideInMenu: true,
            component: './Exception/404',
          },
          {
            path: '/exception/500',
            name: 'server-error',
            hideInMenu: true,
            component: './Exception/500',
          },
          {
            path: '/exception/trigger',
            name: 'trigger',
            hideInMenu: true,
            component: './Exception/TriggerException',
          },
        ],
      },
    ],
  },
];
